package com.dangdang.action.authorize;

import com.dangdang.action.BaseAction;
import com.dangdang.domain.User;
import com.dangdang.service.AuthorizeService;
import com.dangdang.service.ServiceFactory;
import com.dangdang.util.Constants;

/**
 * 注册执行类
 * 
 * @author Wangpeihu
 * @team [Never give up]
 * @since JDK1.6(建议)
 * @date 2010-1-25
 */
public class RegisterAction extends BaseAction {
	private User user;

	private final AuthorizeService us = ServiceFactory.getAuthorizeService();

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	/**
	 * 执行方法
	 * 
	 * @return
	 * @throws Exception
	 */
	public String execute() throws Exception {
		us.addUser(user);
		session.put(Constants.USER_KEY, user);
		return "success";
	}
}
